import request from '@/utils/request'
import Qs from 'qs'


//  删除访客
export function deleteVisitorser(id="1") {
  return request.service({
    url: `/visitoruser/delete/${id}`,
    method: 'delete',
  })
}

// 新增访客
export function addVisitorser(data) {
  return request.service({
    url: `/visitoruser/insert`,
    method: 'post',
    data
  })
}

// 访客列表查询
export function getVisitorserList(pageNo,pageSize,vuTagId = null,vuName=null) {
  return request.service({
    url: `/visitoruser/queryPage`,
    method: 'post',
    data: {
      pageNo: pageNo,
      pageSize: pageSize,
      vuTagId :vuTagId,
      vuName: vuName
    }
  })
}

// 批量更新访客
export function updateVisitorser(data) {
  return request.service({
    url: `/visitoruser/updateTagBatch`,
    method: 'put',
    data
  })
}

// 修改备注名
export function editRemarkName(data) {
  return request.service({
    url: `/visitoruser/update`,
    method: 'put',
    data
  })
}

// 用户标签列表查询
export function getUsertag(data) {
  return request.service({
    url: `/usertag/queryPage`,
    method: 'post',
    data
  })
}

// 用户标签列表添加
export function addUsertag(data) {
  return request.service({
    url: `/usertag/insert`,
    method: 'post',
    data
  })
}

// 用户标签列表删除
export function delUsertag(id="null") {
  return request.service({
    url: `/usertag/delete/${id}`,
    method: 'delete',
  })
}

// 用户标签列表修改
export function updateUsertag(data) {
  return request.service({
    url: `/usertag/update`,
    method: 'put',
    data
  })
}

// 黑名单查询列表
export function getBlacklist(pageNo,pageSize,vuName=null) {
  return request.service({
    url: `/blacklist/queryPage`,
    method: 'post',
    data: {
      pageNo: pageNo,
      pageSize: pageSize,
      
      vuName: vuName
    }
  })
}

// 移除黑名单列表
export function delBlacklist(data) {
  return request.service({
    url: `/blacklist/deleteBatch`,
    method: 'post',
    data
  })
}
// 修改备注
export function editBlacklist(data) {
  return request.service({
    url: `/blacklist/update`,
    method: 'put',
    data
  })
}

// 批量加入黑名单
export function addBatchBlacklist(data) {
  return request.service({
    url: `/blacklist/insertBatch`,
    method: 'post',
    data
  })
}

// 加入黑名单(单个)
export function addBlacklist(data) {
  return request.service({
    url: `/blacklist/insert`,
    method: 'post',
    data
  })
}

// 移出黑名单(单个)
export function delSingleBlacklist(id) {
  return request.service({
    url: `/blacklist/delete/${id}`,
    method: 'delete',
  })
}

// 批量移出黑名单
export function delBatchBlacklist(data) {
  return request.service({
    url: `/blacklist/deleteBatch`,
    method: 'delete',
    params: {
      id: data
    },
    paramsSerializer: function (params) {
      return Qs.stringify(params, {
        arrayFormat: 'repeat'
      })
    }
  })
}

// 访客分析头部数据
export function getHeaderData(data) {
  return request.service({
    url: `/visitorAnalysis/queryForHeader`,
    method: 'post',
    data
  })
}

// 访客数量图表
export function getTimeDimVisitorUser(data) {
  return request.service({
    url: `/visitorAnalysis/queryTimeDimVisitorUser`,
    method: 'post',
    data
  })
}

// 访客来源图表
export function getVisitorSource(data) {
  return request.service({
    url: `/visitorAnalysis/queryTimeDimVisitorSource`,
    method: 'post',
    data
  })
}

// 访客年龄统计图表
export function getVisitorAge(data) {
  return request.service({
    url: `/visitorAnalysis/queryTimeDimVisitorAge`,
    method: 'post',
    data
  })
}

// 访客性别统计图表
export function getVisitorSex(data) {
  return request.service({
    url: `/visitorAnalysis/queryTimeDimVisitorGender`,
    method: 'post',
    data
  })
}

// 地图图表
export function getMapData(data) {
  return request.service({
    url: `/visitorAnalysis/queryRegionBoard`,
    method: 'post',
    data
  })
}

// 传播图谱
export function getAtlasData(data) {
  return request.service({
    url: `/visitorAnalysis/queryVisitorAtlas`,
    method: 'post',
    data
  })
}

export function queryVisitorSpreadRank(data) {
  return request.service({
    url: `/visitorAnalysis/queryVisitorSpreadRank`,
    method: 'post',
    data
  })
}


// 传播列表
export function queryVisitorPage(data) {
  return request.service({
    url: `/visitorAnalysis/queryVisitorPage`,
    method: 'post',
    data
  })
}

// 获取用户详情
export function getSpreadDetail(data) {
  return request.service({
    url: `/visitorAnalysis/queryVisitorSpreadPage`,
    method: 'post',
    data
  })
}








